package com.ruoyi.znjc.controller;

import com.ruoyi.znjc.service.impl.ZnjcLLMService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/api/znjc/llm")
public class ZnjcLLMController {

    @Autowired
    private ZnjcLLMService llmService;


    @PostMapping("/chat")
    public ResponseEntity<String> chatWithModel(@RequestBody Map<String, Object> request) {
        String prompt = (String) request.get("prompt");
        // 或者构造 prompt 逻辑放这里
        String response = llmService.chatWithLLM(prompt);
        return ResponseEntity.ok(response);
    }

}
